import 'package:get/get.dart';
import 'package:lishopflu/base/view_import.dart';

import 'test_screen_controller.dart';

class TestScreen extends GetView<TestScreenController> {
  const TestScreen({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final appBar = AppBar(
      title: Text('ListView'),
      actions: [
        IconButton(
          icon: Icon(Icons.publish_sharp),
          onPressed: controller.addOnTop,
        ),
        IconButton(
          icon: Icon(Icons.download_rounded),
          onPressed: controller.addOnBottom,
        ),
        IconButton(
          icon: Icon(Icons.clear),
          onPressed: controller.data.clear,
        ),
      ],
    );

    return Scaffold(
      appBar: appBar,
      body: Obx(
            () => ListView.separated(
          shrinkWrap: true,
          itemCount: controller.data.length,
          separatorBuilder: (_, index) => Divider(),
          itemBuilder: (_, index) => Text(
            controller.data[index],
          ),
        ),
      ),
    );
  }
}